//
//  ExhibitDetailModel.m
//  ArtDog
//
//  Created by dllo on 16/9/19.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ExhibitDetailModel.h"
#import "ExhibitGalleryModel.h"
#import "ExhibitWorksModel.h"

@implementation ExhibitDetailModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"id"]) {
        _idField = value;
    }
}

- (void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"works"]) {
        NSMutableArray<ExhibitWorksModel *> *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            ExhibitWorksModel *workModel = [ExhibitWorksModel modelWithDic:dic];
            [array addObject:workModel];
        }
        _works = array;
    }
    if ([key isEqualToString:@"gallery"]) {
        ExhibitGalleryModel *galleryModel = [ExhibitGalleryModel modelWithDic:value];
        _gallery = galleryModel;
    }
}

@end
